2020-2021 Sunseeker Telemetry and Lighting System
usci_a_uart.h
Go to the documentation of this file.
1 //*****************************************************************************
2 //
3 // usci_a_uart.h - Driver for the USCI_A_UART Module.
4 //
5 //*****************************************************************************
6 
7 #ifndef __MSP430WARE_USCI_A_UART_H__
8 #define __MSP430WARE_USCI_A_UART_H__
9 
10 #include "inc/hw_memmap.h"
11 
12 #ifdef __MSP430_HAS_USCI_Ax__
13 
14 //*****************************************************************************
15 //
16 // If building with a C++ compiler, make all of the definitions in this header
17 // have a C binding.
18 //
19 //*****************************************************************************
20 #ifdef __cplusplus
21 extern "C"
22 {
23 #endif
24 
25 #include "inc/hw_memmap.h"
26 //*****************************************************************************
27 //
28 // The following values are the sync characters possible
29 //
30 //*****************************************************************************
31 #define DEFAULT_SYNC 0x00
32 #define USCI_A_UART_AUTOMATICBAUDRATE_SYNC 0x55
33 
34 //*****************************************************************************
35 //
37 //
38 //*****************************************************************************
39 typedef struct USCI_A_UART_initParam {
44  uint8_t selectClockSource;
46  uint16_t clockPrescalar;
50  uint8_t firstModReg;
54  uint8_t secondModReg;
60  uint8_t parity;
65  uint8_t msborLsbFirst;
70  uint8_t numberofStopBits;
77  uint8_t uartMode;
82  uint8_t overSampling;
83 } USCI_A_UART_initParam;
84 
85 
86 //*****************************************************************************
87 //
88 // The following are values that can be passed to the param parameter for
89 // functions: USCI_A_UART_init().
90 //
91 //*****************************************************************************
92 #define USCI_A_UART_NO_PARITY 0x00
93 #define USCI_A_UART_ODD_PARITY 0x01
94 #define USCI_A_UART_EVEN_PARITY 0x02
95 
96 //*****************************************************************************
97 //
98 // The following are values that can be passed to the param parameter for
99 // functions: USCI_A_UART_init().
100 //
101 //*****************************************************************************
102 #define USCI_A_UART_MSB_FIRST UCMSB
103 #define USCI_A_UART_LSB_FIRST 0x00
104 
105 //*****************************************************************************
106 //
107 // The following are values that can be passed to the param parameter for
108 // functions: USCI_A_UART_init().
109 //
110 //*****************************************************************************
111 #define USCI_A_UART_MODE UCMODE_0
112 #define USCI_A_UART_IDLE_LINE_MULTI_PROCESSOR_MODE UCMODE_1
113 #define USCI_A_UART_ADDRESS_BIT_MULTI_PROCESSOR_MODE UCMODE_2
114 #define USCI_A_UART_AUTOMATIC_BAUDRATE_DETECTION_MODE UCMODE_3
115 
116 //*****************************************************************************
117 //
118 // The following are values that can be passed to the param parameter for
119 // functions: USCI_A_UART_init().
120 //
121 //*****************************************************************************
122 #define USCI_A_UART_CLOCKSOURCE_SMCLK UCSSEL__SMCLK
123 #define USCI_A_UART_CLOCKSOURCE_ACLK UCSSEL__ACLK
124 
125 //*****************************************************************************
126 //
127 // The following are values that can be passed to the param parameter for
128 // functions: USCI_A_UART_init().
129 //
130 //*****************************************************************************
131 #define USCI_A_UART_ONE_STOP_BIT 0x00
132 #define USCI_A_UART_TWO_STOP_BITS UCSPB
133 
134 //*****************************************************************************
135 //
136 // The following are values that can be passed to the param parameter for
137 // functions: USCI_A_UART_init().
138 //
139 //*****************************************************************************
140 #define USCI_A_UART_OVERSAMPLING_BAUDRATE_GENERATION 0x01
141 #define USCI_A_UART_LOW_FREQUENCY_BAUDRATE_GENERATION 0x00
142 
143 //*****************************************************************************
144 //
145 // The following are values that can be passed to the mask parameter for
146 // functions: USCI_A_UART_enableInterrupt(), and
147 // USCI_A_UART_disableInterrupt().
148 //
149 //*****************************************************************************
150 #define USCI_A_UART_RECEIVE_INTERRUPT UCRXIE
151 #define USCI_A_UART_TRANSMIT_INTERRUPT UCTXIE
152 #define USCI_A_UART_RECEIVE_ERRONEOUSCHAR_INTERRUPT UCRXEIE
153 #define USCI_A_UART_BREAKCHAR_INTERRUPT UCBRKIE
154 
155 //*****************************************************************************
156 //
157 // The following are values that can be passed to the mask parameter for
158 // functions: USCI_A_UART_getInterruptStatus(), and
159 // USCI_A_UART_clearInterrupt() as well as returned by the
160 // USCI_A_UART_getInterruptStatus() function.
161 //
162 //*****************************************************************************
163 #define USCI_A_UART_RECEIVE_INTERRUPT_FLAG UCRXIFG
164 #define USCI_A_UART_TRANSMIT_INTERRUPT_FLAG UCTXIFG
165 
166 //*****************************************************************************
167 //
168 // The following are values that can be passed to the mask parameter for
169 // functions: USCI_A_UART_queryStatusFlags() as well as returned by the
170 // USCI_A_UART_queryStatusFlags() function.
171 //
172 //*****************************************************************************
173 #define USCI_A_UART_LISTEN_ENABLE UCLISTEN
174 #define USCI_A_UART_FRAMING_ERROR UCFE
175 #define USCI_A_UART_OVERRUN_ERROR UCOE
176 #define USCI_A_UART_PARITY_ERROR UCPE
177 #define USCI_A_UART_BREAK_DETECT UCBRK
178 #define USCI_A_UART_RECEIVE_ERROR UCRXERR
179 #define USCI_A_UART_ADDRESS_RECEIVED UCADDR
180 #define USCI_A_UART_IDLELINE UCIDLE
181 #define USCI_A_UART_BUSY UCBUSY
182 
183 //*****************************************************************************
184 //
185 // Prototypes for the APIs.
186 //
187 //*****************************************************************************
188 
189 //*****************************************************************************
190 //
212 //
213 //*****************************************************************************
214 extern bool USCI_A_UART_init(uint16_t baseAddress,
215  USCI_A_UART_initParam *param);
216 
217 //*****************************************************************************
218 //
230 //
231 //*****************************************************************************
232 extern void USCI_A_UART_transmitData(uint16_t baseAddress,
233  uint8_t transmitData);
234 
235 //*****************************************************************************
236 //
247 //
248 //*****************************************************************************
249 extern uint8_t USCI_A_UART_receiveData(uint16_t baseAddress);
250 
251 //*****************************************************************************
252 //
273 //
274 //*****************************************************************************
275 extern void USCI_A_UART_enableInterrupt(uint16_t baseAddress,
276  uint8_t mask);
277 
278 //*****************************************************************************
279 //
299 //
300 //*****************************************************************************
301 extern void USCI_A_UART_disableInterrupt(uint16_t baseAddress,
302  uint8_t mask);
303 
304 //*****************************************************************************
305 //
323 //
324 //*****************************************************************************
325 extern uint8_t USCI_A_UART_getInterruptStatus(uint16_t baseAddress,
326  uint8_t mask);
327 
328 //*****************************************************************************
329 //
345 //
346 //*****************************************************************************
347 extern void USCI_A_UART_clearInterrupt(uint16_t baseAddress,
348  uint8_t mask);
349 
350 //*****************************************************************************
351 //
361 //
362 //*****************************************************************************
363 extern void USCI_A_UART_enable(uint16_t baseAddress);
364 
365 //*****************************************************************************
366 //
376 //
377 //*****************************************************************************
378 extern void USCI_A_UART_disable(uint16_t baseAddress);
379 
380 //*****************************************************************************
381 //
412 //
413 //*****************************************************************************
414 extern uint8_t USCI_A_UART_queryStatusFlags(uint16_t baseAddress,
415  uint8_t mask);
416 
417 //*****************************************************************************
418 //
430 //
431 //*****************************************************************************
432 extern void USCI_A_UART_setDormant(uint16_t baseAddress);
433 
434 //*****************************************************************************
435 //
445 //
446 //*****************************************************************************
447 extern void USCI_A_UART_resetDormant(uint16_t baseAddress);
448 
449 //*****************************************************************************
450 //
460 //
461 //*****************************************************************************
462 extern void USCI_A_UART_transmitAddress(uint16_t baseAddress,
463  uint8_t transmitAddress);
464 
465 //*****************************************************************************
466 //
481 //
482 //*****************************************************************************
483 extern void USCI_A_UART_transmitBreak(uint16_t baseAddress);
484 
485 //*****************************************************************************
486 //
495 //
496 //*****************************************************************************
497 extern uint32_t USCI_A_UART_getReceiveBufferAddressForDMA(uint16_t baseAddress);
498 
499 //*****************************************************************************
500 //
509 //
510 //*****************************************************************************
511 extern uint32_t USCI_A_UART_getTransmitBufferAddressForDMA(uint16_t baseAddress);
512 
513 //*****************************************************************************
514 //
515 // Mark the end of the C bindings section for C++ compilers.
516 //
517 //*****************************************************************************
518 #ifdef __cplusplus
519 }
520 #endif
521 
522 #endif
523 #endif // __MSP430WARE_USCI_A_UART_H__
uint8_t transmitData
MPU_initThreeSegmentsParam param